#include <stdio.h>
#include <stdlib.h>
#define len 5
typedef struct linkstack
{
	int myst[len];
	int max;
	int flag;
}link_stack;
int insertstack(link_stack *H);
int outstack(link_stack *H);
int view(link_stack *H);

int main(int argc, const char *argv[])
{
	link_stack *H=(link_stack *)malloc(sizeof(link_stack));
	H->max=len;
	H->flag=-1;
	insertstack(H);
	insertstack(H);
	insertstack(H);
	outstack(H);
	view(H);
	outstack(H);
	view(H);


	return 0;
}

int insertstack(link_stack *H)
{
	if(H->flag==(H->max-1))	
	{
		printf("full\n");
		return -1;
	}
	int inputnum;
	scanf("%d",&inputnum);
	H->flag++;
	H->myst[H->flag]=inputnum;

	return 0;
}

int outstack(link_stack *H)
{
	if(H->flag==-1)
	{
		printf("empty\n");
		return -1;
	}
	H->flag--;

	return 0;
}

int view(link_stack *H)
{
	if(H->flag==-1)
	{
		printf("empty\n");
		return -1;
	}
	for(int i=0;i<(H->flag+1);i++)
	{
		printf("%d ",H->myst[i]);
	}
	printf("\n");

	return 0;
}
